
{include file="public/header" /}
<body>
<div class="bg"></div>
<div class="container">
    <div class="line bouncein">
        <div class="xs6 xm4 xs3-move xm4-move">
            <div style="height:150px;"></div>
            <div class="media media-y margin-big-bottom">
            </div>
            <form id="form" action="" method="post">
                <div class="panel loginbox">
                    <div class="text-center margin-big padding-big-top"><h1>后台登录</h1></div>
                    <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
                        <div class="form-group">
                            <div class="field field-icon-right">

                                <input type="text" class="input input-big" name="name" placeholder="请输入账号" data-validate="请输入账号" />
                                <span class="icon icon-user margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field field-icon-right">

                                <input type="password" class="input input-big" name="pwd" placeholder="请输入密码" data-validate="请输入密码" />
                                <span class="icon icon-key margin-small"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="field">

                                <input type="text" class="input input-big" name="code" placeholder="请输入验证码" data-validate="请输入验证码" />
                                <img id="code_img" src="{:U('login/verify')}" alt="" width="100" height="32" class="passcode" style="height:43px;cursor:pointer;" onclick="this.src='{:U('login/verify')}?t='+new Date().getTime()">

                            </div>
                        </div>
                    </div>

                    <div style="padding:30px;"><a type="button"   onclick="  submit();" class="button button-block bg-main text-big input-big"  value="登录" >登录</a> </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    function submit(){
        var formdata=new FormData($("#form")[0]);
        $.ajax({
            type:"post",
            url:"{:U('login/login')}",
            data:formdata,
            dataType:"json",
            processData:false,
            contentType:false,
            cache:false,
            success:function(rs){
                layer.msg(rs.msg);
                changeCode();
                if(rs.res==1 && rs.data.url !=undefined){
                    window.location=rs.data.url;
                }

            }
        });
    }
    function changeCode(){
        var url="{:U('login/verify')}?t="+new Date().getTime()
        $("#code_img").attr("src",url);
    }

</script>
{include file="public/footer" /}